from django.contrib import admin

from prj002.models import (
    clinical, cure, disease, experiment, status,
    info, standard, summary, history, bxray
)
from prj002.utils.same_code import SCAdmin


@admin.register(info.Info)
class InfoAdmin(admin.ModelAdmin, SCAdmin):
    list_display = ('serial', 'patient_name', 'hospital_name', 'check_status', 'create_time', 'owner_link')
    search_fields = ['serial', 'patient_name', 'hospital_name', 'nation', 'check_status']
    list_filter = ['owner']


@admin.register(summary.Summary)
class SummaryAdmin(admin.ModelAdmin, SCAdmin):
    list_display = ('id', 'is_normal', 'normal', 'abnormal', 'create_time', 'info_link', 'owner_link')
    search_fields = ['id', 'owner']
    list_filter = ['owner', 'info']


@admin.register(standard.Standard)
class StandardAdmin(admin.ModelAdmin, SCAdmin):
    list_display = ('id', 'clinical_standard', 'china_standard', 'create_time', 'info_link', 'owner_link')
    search_fields = ['id', 'owner']
    list_filter = ['owner', 'info']


@admin.register(history.History)
class HistoryAdmin(admin.ModelAdmin, SCAdmin):
    list_display = ('id', 'duonang_year', 'duonang_month', 'other_disease', 'create_time', 'info_link', 'owner_link')
    search_fields = ['id', 'owner']
    list_filter = ['owner', 'info']


@admin.register(experiment.Experiment)
class ExperimentAdmin(admin.ModelAdmin, SCAdmin):
    list_display = ('id', 'check_luanpao', 'create_time', 'info_link', 'owner_link')
    search_fields = ['id', 'owner']
    list_filter = ['owner', 'info']


@admin.register(bxray.Bxray)
class BxrayAdmin(admin.ModelAdmin, SCAdmin):
    list_display = ('id', 'zigong_chang', 'create_time', 'info_link', 'owner_link')
    search_fields = ['id', 'owner']
    list_filter = ['owner', 'info']


@admin.register(cure.Cure)
class CureAdmin(admin.ModelAdmin, SCAdmin):
    list_display = ('id', 'shenghuo_eat', 'create_time', 'info_link', 'owner_link')
    search_fields = ['id', 'owner']
    list_filter = ['owner', 'info']


@admin.register(clinical.Clinical)
class ClinicalAdmin(admin.ModelAdmin, SCAdmin):
    list_display = ('id', 'zhong_bi', 'bian_xu_piqi', 'xi_duo', 'info_link', 'owner_link')
    search_fields = ['id', 'owner']
    list_filter = ['owner', 'info']


@admin.register(disease.Disease)
class DiseaseAdmin(admin.ModelAdmin, SCAdmin):
    list_display = ('id', 'chun', 'xiae', 'xiongbu', 'info_link', 'owner_link')
    search_fields = ['id', 'owner']
    list_filter = ['owner', 'info']


@admin.register(status.InfoStatus)
class InfoStatusAdmin(admin.ModelAdmin):
    list_display = ('id', 'info_serial', 'fix_name_chinese', 'fix_before', 'fix_after')
    search_fields = ['id', ]
    list_filter = ['id', ]
